Import('env', 'envCython', 'arch', 'SHARED')

if SHARED:
  fxn = env.SharedLibrary
else:
  fxn = env.Library

common_libs = [
  'params.cc',
  'swaglog.cc',
  'util.cc',
]

_common = fxn('common', common_libs, LIBS=["json11", "lmdb"])

Export('_common')

if GetOption('test'):
  env.Program('tests/test_util', ['tests/test_util.cc'], LIBS=[_common])
  env.Program('tests/test_swaglog', ['tests/test_swaglog.cc'], LIBS=[_common, 'json11', 'zmq', 'pthread', 'lmdb'])

# Cython
envCython.Program('clock.so', 'clock.pyx')
envCython.Program('params_pyx.so', 'params_pyx.pyx', LIBS=envCython['LIBS'] + [_common, 'zmq', 'json11', 'lmdb'])
